# /usr/bin/python
# encoding: utf-8
##################
# 发送语音
##################
import urllib

import requests
import re
import time


def login():
    # data=
    url = "http://sms.53api.com/sdk/SMS"
    session = requests.Session()

    data = {
        "cmd": "sendvoice",
        "uid": "2064",
        "psw": "xxxxxxxx",
        "mobiles": "13923774277",
        "msgid":"123123",
        "msg":"您好。欢迎使用。"
    }
    data=urllib.parse.urlencode(data, encoding='gbk')
    print(data)
    headers = {
        "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "Accept-Encoding": "gzip, deflate",
        "Accept-Language": "zh-CN,zh;q=0.9",
        "Cache-Control": "no-cache",
        "Connection": "keep-alive",
        "Content-Type": "application/x-www-form-urlencoded",
        "Pragma": "no-cache",
        "Upgrade-Insecure-Requests": "1",
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36"
    }

    print("send start...")
    # r = session.post(url, headers=headers, data=data)
    # print(r.status_code)
    # print(r.content)
    #
    # resp = r.content.decode('utf-8')
    # print(resp)


login()

a=urllib.parse.quote("您好。欢迎使用。".encode("utf8"))
# 'a=%E6%92%92%E5%9C%B0%E6%96%B9'
print(a)
a=urllib.parse.quote("您好。欢迎使用。".encode("gbk"))
#'a=%C8%F6%B5%D8%B7%BD'
print(a)
